package com.lgc.demo.hashmapTest;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class HashmapTest {
    public static void main(String[] args){
        try {
            Map<String, Integer> mapTest = new HashMap<>(1);
            mapTest.put("a",1);

            ConcurrentHashMap<String,String> concurrentHashMap = new ConcurrentHashMap<>();

            int size = mapTest.size();

            Map<String, Integer> map = new HashMap<>();
            Integer a = map.put("a", 1); //成功并且key不存在，近回null
            a = map.put("b", 2);
            a = map.put("a", 11);//成功并且key已存在，近回old的value值
            a = map.put("a", 111);

            String aa = "abc";
            int inta = aa.hashCode();

            for (Map.Entry<String, Integer> item :
                    map.entrySet()) {
                System.out.println(item.getKey() + " " + item.getValue());
            }
        }catch (Exception e){
            int a=0;
        }
    }
}
